from appium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

class Base():
    def __init__(self):
        cap={
            "platformName": "Android",
            "appium:deviceName": "emulator-5554",
            "appium:automationName": "uiautomator2",
            "appium:appPackage": "com.kongfz.app",
            "appium:appActivity": ".home.mvvm.homepage.HomeActivity",
            "appium:noReset": True
        }
        self.driver=webdriver.Remote('http://127.0.0.1:4723/wd/hub',cap)
        #等待
        # self.driver.save_screenshot(20)
    #初始化
    def self_ele(self,loc):
        ele=self.driver.find_element(*loc)
        return  ele
    #
    # # 等待
    # def jieping(self):
    #     WebDriverWait.until(EC.element_to_be_clickable(20))
    #
    # #关闭
    # def guanbi(self):
    #     self.driver.close()
    #
    # #元素定位
    # def dingwei(self,x,y,z):
    #     self.driver.tap([x,y],z)

